package com.max.sportmanage.util;

import com.max.sportmanage.common.Result;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

/**
 * @program: sport-manage-java
 * @description:分页工具
 * @author: max-qaq
 * @create: 2021-10-18 00:09
 **/
@EqualsAndHashCode(callSuper = true)
@Data
public class PageResult<T> extends Result<T> implements Serializable {
    /**
     * 总记录数
     */
    private long total;

    /**
     * 分页的数据
     */
    private List<T> rows;

    public PageResult(long total,List<T> rows){
        this.total = total;
        this.rows = rows;
        this.setCode(0);
        this.setMessage("成功");
    }

    public static Result pageResult(int total,List rows){
        return new PageResult(total,rows);
    }
}
